import config from '../config';
import Axios from '../utils/axios';

import type {
  BroadcastReq,
  BroadcastRes,
  StockdiagnosisReq,
  StockdiagnosisRes,
  SearchStockReq,
  SearchStockRes,
  IsShowRes
} from '../types/api';
const apis = config.apis;

const axios = new Axios(30000, true);

const getBroadcastData = (params?: BroadcastReq): Promise<BroadcastRes> =>
  axios.get(apis.broadcastData, { params });
const getStockdiagnosis = (params: StockdiagnosisReq): Promise<StockdiagnosisRes> =>
  axios.get(apis.stockdiagnosis, { params });
const getSearchStock = (params: SearchStockReq): Promise<SearchStockRes> =>
  axios.get(apis.searchStock, { params, withCredentials: false });
const getIsShow = (): Promise<IsShowRes> => axios.get(apis.isShow, { params: {} });

export { getBroadcastData, getStockdiagnosis, getSearchStock, getIsShow };
